'use strict';

/**
 * @param {Egg.Application} app - egg application
 */
module.exports = app => {
  const { router, controller } = app;
  const tokenCheck = app.middleware.tokenVerify(app);

  // 重定向到swagger-ui.html
  app.router.redirect('/', '/swagger-ui.html', 302);
  // common
  router.put('/refreshToken', controller.common.refreshToken);

  // user
  router.post('/login', controller.user.login);
  router.get('/getInfo', tokenCheck, controller.user.getInfo);
  router.post('/user', tokenCheck, controller.user.addUser);
  router.get('/user', tokenCheck, controller.user.getUsers);

};
